package main;

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;

public class Spawnable {
	private final Location location;
	
	public Spawnable(Location location) {
		this.location = location;
	}

	public boolean isValid() {
		switch (location.getBlock().getType()) {
		case AIR:
		case CACTUS:
		case LAVA:
		case WATER:
		case LEAVES:
		case LOG:
			return false;
		default:
			Block upOne = location.getBlock().getRelative(0, 1, 0);
			Block upTwo = location.getBlock().getRelative(0, 2, 0);
			return upOne.getType().equals(Material.AIR) && upTwo.getType().equals(Material.AIR);
		}
	}
	
	public Location getLocation() {
		return location;
	}
}
